﻿@using Coralcode.Adapter.Gather.Entity.Enums
@using Coralcode.Adapter.Gather.Entity.Models
@using CoralNode.MvcClient.Helper

@{
    ViewBag.Title = "Rss列表";
}
@Html.IncludePage("CoralAdmin/gather", "_Left")
<!--content-->
    <div id="pbody">
        <div class="extra">
            <div class="pbody_top">
                <span class="ico ico_import"></span><span class="t t_c">采集管理  /  <b class="t_small f_no">Rss列表</b></span>
            </div>
            <div id="main" class="data_import_cnt">
                <div class="js_tabcnt">
                    <div class="tablelist_style1" data-js="tabellist_style1">
                        <div class="funsearch p_1 pl_2 pr_2 extra_normal">
                            <div class="form_main">
                                <a class="btn_5 f_l" href="@Url.Action("AddRss","Gather")">新增</a>
                            </div>
                        </div>                        <table cellpadding="0" cellspacing="0">
                            <tr class="exclude">
                                <th width="5%">选择</th>
                                <th width="24%" align="left">Rss名称</th>
                                <th width="17%"> 导入目标</th>
                                <th width="17%"> 导入状态</th>
                                <th width="17%"> 操作</th>
                            </tr>
                            @foreach (GatherCollectionModel item in Model)
                            {
                                <tr>
                                    <td>
                                        <label class="checkbox_own">
                                            <input type="checkbox" /></label></td>
                                    <td class="td_left"><a href="@Url.Action("gatherlist",new { gatherId = ViewBag.GatherId, collectionId = item.HashCode })">@item.Name</a></td>
                                    @if (item.PrototypeCategoryId > 0)
                                    {
                                        <td>@item.PrototypeName>@item.PrototypeCategoryName</td>
                                    }
                                    else
                                    {
                                        <td>未指定导入目标</td>
                                    }
                                    <td>
                                        @if (item.LastImportTime.HasValue)
                                        {
                                            @String.Format("{0}<br />成功{1}条 / 失败{2}条",item.LastImportTime.Value.ToString("yyyy/MM/dd HH:mm"),item.SuccessCount,item.FaildCount)
                                        }
                                        else
                                        {
                                            @String.Format("未导入")
                                        }
                                    </td>
                                    <td>
                                        <div class="fun">
                                            @Html.ActionLink("查看内容", "gatherlist", new { gatherId = ViewBag.GatherId, collectionId = item.HashCode })
                                            <a href="@Url.Action("binddataproperties",new{gatherId=ViewBag.GatherId, collectionId = item.HashCode})">更改导入目标</a>
                                            @if (item.PrototypeCategoryId > 0){
                                                @Html.ActionLink("导入数据库", "transformationcollection", new { gatherId = ViewBag.GatherId, collectionIds = item.HashCode })
                                            }
                                            <br />
                                            @Html.ActionLink("编辑", "editrss", new { id = item.HashCode })
                                            @Html.ActionLink("删除", "deleterss", new { id = item.HashCode })
                                        </div>
                                    </td>
                                </tr>
                            }
                        </table>
                        <div class="global_fun ">
                            <label class="checkbox_own gloabal_select">
                                <input type="checkbox" /></label>
                            <input type="button" class="btn_4 btn invert" value="反选" /><input type="button" class="btn_4 btn reset"
                                                                                              value="重置" />
                            <a href="" class="js_delete">删除</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script type="text/javascript">
    $(function () {
        $(".import").click(function () {
            if ($("[name='checkboxid']:checked").length == 0) {
                alert("没有选中待导入数据!");
                return;
            }
            var ids = new Array();
            $("[name='checkboxid']:checked").each(function () {
                ids.push($(this).val());
            });
            window.location = "@Url.Action("transformationmulti", new { gatherid = Request["gatherId"] })&ids=" + ids.join();
        });
    });
</script>
